package net.lab1024.sa.admin.module.yitihua.controller;

import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119CommunityAddForm;
import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119CommunityQueryForm;
import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119CommunityUpdateForm;
import net.lab1024.sa.admin.module.yitihua.domain.vo.Cfs119CommunityVO;
import net.lab1024.sa.admin.module.yitihua.service.Cfs119CommunityService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 一体化平台社区信息 Controller
 *
 * @Author cfsjiazy
 * @Date 2025-09-12 10:03:37
 * @Copyright  
 */

@RestController
@Tag(name = "一体化平台社区信息")
public class Cfs119CommunityController {

    @Resource
    private Cfs119CommunityService cfs119CommunityService;

    @Operation(summary = "分页查询 @author cfsjiazy")
    @PostMapping("/cfs119Community/queryPage")
    @SaCheckPermission("cfs119Community:query")
    public ResponseDTO<PageResult<Cfs119CommunityVO>> queryPage(@RequestBody @Valid Cfs119CommunityQueryForm queryForm) {
        return ResponseDTO.ok(cfs119CommunityService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author cfsjiazy")
    @PostMapping("/cfs119Community/add")
    @SaCheckPermission("cfs119Community:add")
    public ResponseDTO<String> add(@RequestBody @Valid Cfs119CommunityAddForm addForm) {
        return cfs119CommunityService.add(addForm);
    }

    @Operation(summary = "更新 @author cfsjiazy")
    @PostMapping("/cfs119Community/update")
    @SaCheckPermission("cfs119Community:update")
    public ResponseDTO<String> update(@RequestBody @Valid Cfs119CommunityUpdateForm updateForm) {
        return cfs119CommunityService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author cfsjiazy")
    @PostMapping("/cfs119Community/batchDelete")
    @SaCheckPermission("cfs119Community:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<String> idList) {
        return cfs119CommunityService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author cfsjiazy")
    @GetMapping("/cfs119Community/delete/{id}")
    @SaCheckPermission("cfs119Community:delete")
    public ResponseDTO<String> batchDelete(@PathVariable String id) {
        return cfs119CommunityService.delete(id);
    }
}
